//
//  ColorImageViewController.m
//  帮惠管理员
//
//  Created by reew on 2017/10/31.
//  Copyright © 2017年 reew. All rights reserved.
//

#import "ColorImageViewController.h"
#import "Account.h"
#import "ColorImageCollectionViewCell.h"
#import "MycolorModel.h"
#import "UIColor+Hex.h"
#import "System.h"
@interface ColorImageViewController ()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;

@end

@implementation ColorImageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    [self.collectionView registerNib:[UINib nibWithNibName:@"ColorImageCollectionViewCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"ColorImageCollectionViewCell"];
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 5;
//    [Account sharedAccount].colorArr.count;
}

- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    ColorImageCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ColorImageCollectionViewCell" forIndexPath:indexPath];
//    MycolorModel *colorModel  = [Account sharedAccount].colorArr[indexPath.row];
//    cell.colorName.text = colorModel.colorName;
//    cell.colorName.backgroundColor = [UIColor colorWithHexString:colorModel.colorHex];
    return cell;
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
    return CGSizeMake((kScreenWidth-60)/2, (kScreenWidth-60)/2 +20);
}
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
    return UIEdgeInsetsMake(5, 10, 5, 10);
}
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
